import telnetlib 

host = "192.168.0.133"
port = "23"
user = "sc"
passwd = "123456"

connection = telnetlib.Telnet(host=host, port=port)

connection.read_until(b"Username")
connection.write(user.encode("ascii")+b"\n")

connection.read_until(b"Password")
connection.write(passwd.encode("ascii")+b"\n")


print(connection.read_until(b"<Huawei>").decode("ascii"))

connection.write(b"sys"+b"\n")
print(connection.read_until(b"[Huawei]").decode("ascii"))

connection.close()